package org.xebia.roo.addon.jamon;

import java.util.logging.Logger;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.springframework.roo.shell.CliAvailabilityIndicator;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CommandMarker;

@Component 
@Service
public class JamonCommands implements CommandMarker { // All command types must implement the CommandMarker interface
	
	/**
	 * Get hold of a JDK Logger
	 */
	private Logger log = Logger.getLogger(getClass().getName());

	/**
	 * Get a reference to the JamonOperations from the underlying OSGi container
	 */
	@Reference private JamonOperations operations; 
	
	@CliAvailabilityIndicator("jamon setup")
	public boolean isInstallJamon() {
		return operations.isInstallJamonAvailable(); // This command is always available!
	}
	
	@CliCommand(value = "jamon setup", help = "Setup Jamon into your project")
	public void installJamon() {
		operations.installJamon();
	}
}